package com.qf.controller;


import com.qf.entity.R;
import com.qf.service.UserService;
import com.qf.vo.inputvo.LoginParams;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Resource
    UserService userService;

    /**
     * 登录
     * @param loginParams
     * @return
     */
    @RequestMapping("/login")
    public R login(LoginParams loginParams){
        userService.LoginCheck(loginParams);
        return new R().setCode(200).setMsg("登陆成功");
    }

    /**
     * 验证码发送
     * @param loginParams
     * @return
     */
    @RequestMapping("/sendcode")
    public R SendCode(LoginParams loginParams) throws Exception {
            userService.CodeSend(loginParams);
        return new R().setCode(200).setMsg("验证码发送成功");
    }

    /**
     * 注册操作
     * @param loginParams
     * @return
     */
    @RequestMapping("/reg")
    public R Register(LoginParams loginParams) throws Exception {
            userService.Reg(loginParams);

        return new R().setCode(200).setMsg("注册成功");
    }


}

